// CustomList.cpp : implementation file
//

#include "stdafx.h"
#include "greenftp.h"
#include "CustomList.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCustomList

CCustomList::CCustomList()
{
}

CCustomList::~CCustomList()
{
}


BEGIN_MESSAGE_MAP(CCustomList, CListCtrl)
	//{{AFX_MSG_MAP(CCustomList)
	ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnNMCustomdraw)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCustomList message handlers

void CCustomList::OnNMCustomdraw(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	LPNMLVCUSTOMDRAW  lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR; 

    switch(lplvcd->nmcd.dwDrawStage) 
    {  
	case CDDS_PREPAINT : 
		*pResult = CDRF_NOTIFYITEMDRAW; 
		break; 
	case CDDS_ITEMPREPAINT: 
		*pResult =  CDRF_NOTIFYSUBITEMDRAW; 
		break; 
	case CDDS_SUBITEM | CDDS_ITEMPREPAINT: 
		if(lplvcd->nmcd.dwItemSpec % 2) 
		{ 
			lplvcd->clrTextBk = COLOR_DK_GRAY; 
		} 
		else 
		{ 
			lplvcd->clrText = CLR_DEFAULT;
			lplvcd->clrTextBk = CLR_DEFAULT;
		} 
		break; 
	default: break;
    } 
	
	*pResult = 0;
	*pResult |= CDRF_NOTIFYPOSTPAINT;
	*pResult |= CDRF_NOTIFYITEMDRAW;
	*pResult |= CDRF_NOTIFYSUBITEMDRAW;
}
